package com.jstyle.jclifexd.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jstyle.jclifexd.R;
import com.jstyle.jclifexd.app.MyApplication;
import com.jstyle.jclifexd.model.HeartData;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 打卡
 * Created by Administrator on 2018/8/30.
 */

public class HeartHistoryDetailAdapter extends RecyclerViewBaseAdapter<HeartData> {




    public HeartHistoryDetailAdapter(List<HeartData> mList) {
        super(mList);
    }


    @Override
    protected void bindData(BaseViewHolder holder, int position) {

    }

    @Override
    protected int getLayoutId(int viewType) {
        return R.layout.item_hr_historydetail;
    }

    @Override
    public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new DetailViewHolder(getInflaterView(parent, viewType));
    }



    @Override
    public void onBindViewHolder(BaseViewHolder holder, final int position) {
        HeartData heartData=mDataList.get(position);
        DetailViewHolder detailViewHolder=(DetailViewHolder)holder;
        String time=heartData.getTime();
        int hr=heartData.getHeart();
        detailViewHolder.tvHrTime.setText(time.split(" ")[1]);
        detailViewHolder.tvHrValue.setText(hr+" "+MyApplication.instance().getResources().getString(R.string.hr_laber));
    }

    public class DetailViewHolder extends BaseViewHolder {
        @BindView(R.id.tv_hr_time)
        TextView tvHrTime;
        @BindView(R.id.tv_hrValue)
        TextView tvHrValue;
        @BindView(R.id.tv_avghr)
        TextView tvAvghr;

        public DetailViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

}
